﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json.Linq;
using Touch2Like.Model;
using Touch2Like.DAL;

namespace Touch2Like.Web.api
{
    public partial class touch : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();

            if (Request["act"] == "touch")
            {
                UserTagDAL tag = new UserTagDAL();

                UserTagInfo taginfo = new UserTagInfo();
                taginfo.TagUID = Request["taguid"];
                taginfo.TagContent = Request["tagvalue"];
                taginfo.TagType = Request["tagtype"];
                //taginfo.TagDate = Convert.ToInt64(Request["tagdate"]);
                //taginfo.DeviceId = Request["deviceid"];
                //taginfo.PhoneId = Request["phoneid"];
                //taginfo.PhoneNo = Request["phoneno"];
                //taginfo.PhoneModel = Request["phonemodel"];

                //if (!String.IsNullOrEmpty(Request["gpslocation"]))
                //{
                //    String[] location = Request["gpslocation"].Split(',');

                //    taginfo.Latitude = Convert.ToDecimal(location[0]);
                //    taginfo.Longitude = Convert.ToDecimal(location[1]);
                //}

                //tag.LogIt(taginfo);

                JObject jo = new JObject();
                jo["flag"] = "ok";
                Response.Write(jo.ToString());
            }

            Response.End();
        }
    }
}